package com.lmt_2;

import org.xml.sax.helpers.AttributesImpl;

public class Test1 {
    public static void main(String[] args) {
        Dog dog = new Dog();
        dog.setName("小黑");
        dog.run();
        Cat cat = new Cat();
        cat.setName("小花");
        cat.run();
    }
}

abstract class Animal{
    private String name;

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }
    public abstract void run();
}
class Dog extends Animal{

    @Override
    public void run() {
        System.out.println(getName()+"汪汪叫");
    }

}
class Cat extends Animal{

    @Override
    public void run() {
        System.out.println(getName()+"喵喵叫");
    }
}
